fix: restore the test suite on Python 3.12 (pandas 3, anndata 0.13) - #849
Merged
Conversation
The `Test` workflow has been red on `main` for both 3.12 legs since mid-June - 27 failed, 732 passed, identically on ubuntu and macOS - while 3.11 stays green because it resolves older anndata/pandas. Two unrelated breakages: * `_annotation_mapping` indexed a `pandas.Series` positionally: `v` holds `argmax` positions while `source_df[annotation_label]` is indexed by observation names, so `series[v[i]]` relied on pandas' positional fallback for non-integer indexes. pandas 2 deprecated it, pandas 3 removed it, and all 24 `test_annotation_mapping` cases fail with `KeyError: np.int64(0)`. Use `.iloc`, which is what the fallback did. * `AnnData.concatenate` was removed in anndata, breaking the three `test_set_graph_xy` cases with `AttributeError`. Use `anndata.concat`. Full suite on 3.12 (anndata 0.13.2, pandas 3.0.5): 759 passed, 1 skipped. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #849 +/- ##
=======================================
Coverage 76.62% 76.62%
=======================================
Files 36 36
Lines 4175 4175
Branches 670 670
=======================================
Hits 3199 3199
Misses 679 679
Partials 297 297
🚀 New features to boost your workflow:
|
Collaborator
Author
|
@selmanozleyen, let me know whether I can merge this. |
Collaborator
|
Thanks looks good |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
Testworkflow is red onmainfor both 3.12 legs and has been since mid-June — the scheduled run of 2026-08-15 reports27 failed, 732 passedidentically on ubuntu and macOS. The 3.11 leg stays green because it resolves older anndata/pandas. Two unrelated breakages, both dependency drift:1. Positional indexing of a
pandas.Series(24 failures)src/moscot/base/problems/_mixins.py:288and:312:vholds positions, whilesource_df[annotation_label]is a Series indexed by observation names.series[np.int64(0)]therefore relied on pandas' positional fallback for non-integer indexes, which pandas 2 deprecated and pandas 3 removed:Every
test_annotation_mappingcase (mapping_mode="max", across the space, time and cross-modality mixins) hits this. Fixed with.iloc, which is exactly what the fallback used to do — so the behaviour is unchanged on older pandas too.This one is a genuine bug in moscot rather than a test artefact: any user calling
annotation_mapping(..., mapping_mode="max")on pandas 3 gets the sameKeyError.2.
AnnData.concatenatewas removed (3 failures)tests/problems/base/test_general_problem.pyused the long-deprecated method, givingAttributeError: 'AnnData' object has no attribute 'concatenate'in the threetest_set_graph_xycases. Replaced withanndata.concat([...]).Verification
Full suite on Python 3.12 with anndata 0.13.2 and pandas 3.0.5: 759 passed, 1 skipped, 0 failed (was 732 passed / 27 failed — exactly the 27 restored).
black,isort,ruffclean.Independent of #848 (lint) and #846 (sparsify); together the three take CI back to green.
🤖 Generated with Claude Code